home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / dskut / patch12.zip / TCPATCH.DIF < prev    next >
Text File  |  1990-05-31  |  16KB  |  566 lines

  1. *** ../patch/common.h    Thu May 24 14:21:46 1990
  2. --- common.h    Thu May 31 10:28:21 1990
  3. ***************
  4. *** 1,6 ****
  5. ! /* $Header: common.h,v 2.0.1.2 88/06/22 20:44:53 lwall Locked $
  6.    *
  7.    * $Log:    common.h,v $
  8.    * Revision 2.0.1.2  88/06/22  20:44:53  lwall
  9.    * patch12: sprintf was declared wrong
  10.    * 
  11. --- 1,9 ----
  12. ! /* $Header: common.h,v 2.0.1.3 90/05/30 11:30:00 mward $
  13.    *
  14.    * $Log:    common.h,v $
  15. +  * Revision 2.0.1.3  90/05/30  11:30:00  mward
  16. +  * added TURBOC stuff
  17. +  * 
  18.    * Revision 2.0.1.2  88/06/22  20:44:53  lwall
  19.    * patch12: sprintf was declared wrong
  20.    * 
  21. ***************
  22. *** 40,51 ****
  23. --- 43,68 ----
  24.   #include <ctype.h>
  25.   #include <signal.h>
  26.   
  27. + #ifdef TURBOC20
  28. + #include <stdlib.h>
  29. + #include <string.h>
  30. + #include <io.h>
  31. + #include <fcntl.h>
  32. + #endif
  33.   /* constants */
  34.   
  35.   #define TRUE (1)
  36.   #define FALSE (0)
  37.   
  38. + #ifdef TURBOC20
  39. + #define MAXPATH 80                /* max path spec size */
  40. + #define MAXMEMBLK 65534L            /* biggest block of mem */
  41. + #define MAXHUNKSIZE (MAXMEMBLK/sizeof(char *))    /* is this enough lines? */
  42. + #else
  43.   #define MAXHUNKSIZE 100000        /* is this enough lines? */
  44. + #endif
  45.   #define INITHUNKMAX 125            /* initial dynamic allocation size */
  46.   #define MAXLINELEN 1024
  47.   #define BUFFERSIZE 1024
  48. ***************
  49. *** 145,150 ****
  50. --- 162,168 ----
  51.   
  52.   EXT char *revision INIT(Nullch);    /* prerequisite revision, if any */
  53.   
  54. + #ifndef TURBOC20
  55.   char *malloc();
  56.   char *realloc();
  57.   char *strcpy();
  58. ***************
  59. *** 156,159 ****
  60. --- 174,178 ----
  61.   char *sprintf();
  62.   #else
  63.   int sprintf();
  64. + #endif
  65.   #endif
  66. *** ../patch/config.h    Thu May 24 14:21:52 1990
  67. --- config.h    Thu May 31 10:36:24 1990
  68. ***************
  69. *** 1,25 ****
  70.   /* config.h
  71. !  * This file was produced by running the Configure script.
  72.    * Feel free to modify any of this as the need arises.
  73.    */
  74.   
  75.   
  76. ! #/*undef    EUNICE        /* no file linking? */
  77. ! #/*undef    VMS
  78.   
  79. ! #/*undef    index strchr    /* cultural */
  80. ! #/*undef    rindex strrchr    /*  differences? */
  81.   
  82. - #/*undef    void int    /* is void to be avoided? */
  83.   /* How many register declarations are paid attention to? */
  84.   
  85.   #define Reg1 register
  86.   #define Reg2 register
  87.   #define Reg3 register
  88. ! #define Reg4 register
  89. ! #define Reg5 register
  90. ! #define Reg6 register
  91.   #define Reg7 
  92.   #define Reg8 
  93.   #define Reg9 
  94. --- 1,36 ----
  95. + /* $Header: cofig.h,v 2.0.1 90/05/30 11:30:00 mward $
  96. +  *
  97. +  * $Log:    config.h,v $
  98. +  * Revision 2.0.1  90/05/30  11:30:00  mward
  99. +  * set up for MSDOS TURBOC v2.0
  100. +  */
  101. +  
  102.   /* config.h
  103. !  * This file was produced by hand for MSDOS TURBOC V2.0.
  104.    * Feel free to modify any of this as the need arises.
  105.    */
  106.   
  107.   
  108. ! #undef    EUNICE        /* no file linking? */
  109. ! #undef    VMS
  110. ! #undef    CHARSPRINTF     /* sprintf does NOT return pointer to char */
  111. ! #undef    FLEXFILENAMES    /* file names must be 14 chars or less */
  112.   
  113. ! #ifdef TURBOC20
  114. ! #define    index strchr    /* cultural */
  115. ! #define    rindex strrchr    /*  differences? */
  116. ! #define    VOIDSIG     /* signal returns ptr to function returning void*/
  117. ! #define    VOIDFLAGS 7    /* full void support */
  118. ! #endif
  119.   
  120.   /* How many register declarations are paid attention to? */
  121.   
  122.   #define Reg1 register
  123.   #define Reg2 register
  124.   #define Reg3 register
  125. ! #define Reg4
  126. ! #define Reg5
  127. ! #define Reg6
  128.   #define Reg7 
  129.   #define Reg8 
  130.   #define Reg9 
  131. *** ../patch/inp.c    Thu May 24 14:21:46 1990
  132. --- inp.c    Thu May 31 10:37:49 1990
  133. ***************
  134. *** 1,6 ****
  135. ! /* $Header: inp.c,v 2.0.1.1 88/06/03 15:06:13 lwall Locked $
  136.    *
  137.    * $Log:    inp.c,v $
  138.    * Revision 2.0.1.1  88/06/03  15:06:13  lwall
  139.    * patch10: made a little smarter about sccs files
  140.    * 
  141. --- 1,12 ----
  142. ! /* $Header: inp.c,v 2.0.1.2 90/05/30 11:30:00 mward $
  143.    *
  144.    * $Log:    inp.c,v $
  145. +  * Revision 2.0.1.2  90/05/30  11:30:00 mward
  146. +  * if TURBOC20 have plan_a check against MAXMEMBLK before mallocs
  147. +  * if TURBOC20 have plan_b use binary mode io for tmp file
  148. +  * modified plan_a to allow for translation shrinkage on text reads
  149. +  * modify calls to read, write to detect error on return value of -1
  150. +  * 
  151.    * Revision 2.0.1.1  88/06/03  15:06:13  lwall
  152.    * patch10: made a little smarter about sccs files
  153.    * 
  154. ***************
  155. *** 120,128 ****
  156.       out_of_mem = FALSE;
  157.       return FALSE;            /* force plan b because plan a bombed */
  158.       }
  159. - #ifdef lint
  160.       i_womp = Nullch;
  161. ! #else
  162.       i_womp = malloc((MEM)(i_size+2));    /* lint says this may alloc less than */
  163.                       /* i_size, but that's okay, I think. */
  164.   #endif
  165. --- 126,136 ----
  166.       out_of_mem = FALSE;
  167.       return FALSE;            /* force plan b because plan a bombed */
  168.       }
  169.       i_womp = Nullch;
  170. ! #ifndef lint
  171. ! #ifdef TURBOC20
  172. !     if (i_size < MAXMEMBLK)
  173. ! #endif
  174.       i_womp = malloc((MEM)(i_size+2));    /* lint says this may alloc less than */
  175.                       /* i_size, but that's okay, I think. */
  176.   #endif
  177. ***************
  178. *** 131,137 ****
  179.       if ((ifd = open(filename, 0)) < 0)
  180.       fatal2("Can't open file %s\n", filename);
  181.   #ifndef lint
  182. !     if (read(ifd, i_womp, (int)i_size) != i_size) {
  183.       Close(ifd);    /* probably means i_size > 15 or 16 bits worth */
  184.       free(i_womp);    /* at this point it doesn't matter if i_womp was */
  185.       return FALSE;    /*   undersized. */
  186. --- 139,145 ----
  187.       if ((ifd = open(filename, 0)) < 0)
  188.       fatal2("Can't open file %s\n", filename);
  189.   #ifndef lint
  190. !     if ((i_size=(unsigned)read(ifd, i_womp, (int)i_size)) == (unsigned)-1) {
  191.       Close(ifd);    /* probably means i_size > 15 or 16 bits worth */
  192.       free(i_womp);    /* at this point it doesn't matter if i_womp was */
  193.       return FALSE;    /*   undersized. */
  194. ***************
  195. *** 149,157 ****
  196.       if (*s == '\n')
  197.           iline++;
  198.       }
  199. - #ifdef lint
  200.       i_ptr = Null(char**);
  201. ! #else
  202.       i_ptr = (char **)malloc((MEM)((iline + 2) * sizeof(char *)));
  203.   #endif
  204.       if (i_ptr == Null(char **)) {    /* shucks, it was a near thing */
  205. --- 157,167 ----
  206.       if (*s == '\n')
  207.           iline++;
  208.       }
  209.       i_ptr = Null(char**);
  210. ! #ifndef lint
  211. ! #ifdef TURBOC20
  212. !     if (iline+2<MAXMEMBLK/sizeof(char *))
  213. ! #endif
  214.       i_ptr = (char **)malloc((MEM)((iline + 2) * sizeof(char *)));
  215.   #endif
  216.       if (i_ptr == Null(char **)) {    /* shucks, it was a near thing */
  217. ***************
  218. *** 210,215 ****
  219. --- 220,228 ----
  220.       fatal2("Can't open file %s\n", filename);
  221.       if ((tifd = creat(TMPINNAME, 0666)) < 0)
  222.       fatal2("Can't open file %s\n", TMPINNAME);
  223. + #ifdef TURBOC20
  224. +     setmode(tifd, O_BINARY);
  225. + #endif
  226.       while (fgets(buf, sizeof buf, ifp) != Nullch) {
  227.       if (revision != Nullch && !found_revision && rev_in_string(buf))
  228.           found_revision = TRUE;
  229. ***************
  230. *** 245,257 ****
  231.       fatal1("Can't seem to get enough memory.\n");
  232.       for (i=1; ; i++) {
  233.       if (! (i % lines_per_buf))    /* new block */
  234. !         if (write(tifd, tibuf[0], BUFFERSIZE) < BUFFERSIZE)
  235.           fatal1("patch: can't write temp file.\n");
  236.       if (fgets(tibuf[0] + maxlen * (i%lines_per_buf), maxlen + 1, ifp)
  237.         == Nullch) {
  238.           input_lines = i - 1;
  239.           if (i % lines_per_buf)
  240. !         if (write(tifd, tibuf[0], BUFFERSIZE) < BUFFERSIZE)
  241.               fatal1("patch: can't write temp file.\n");
  242.           break;
  243.       }
  244. --- 258,270 ----
  245.       fatal1("Can't seem to get enough memory.\n");
  246.       for (i=1; ; i++) {
  247.       if (! (i % lines_per_buf))    /* new block */
  248. !         if (write(tifd, tibuf[0], BUFFERSIZE) == -1)
  249.           fatal1("patch: can't write temp file.\n");
  250.       if (fgets(tibuf[0] + maxlen * (i%lines_per_buf), maxlen + 1, ifp)
  251.         == Nullch) {
  252.           input_lines = i - 1;
  253.           if (i % lines_per_buf)
  254. !         if (write(tifd, tibuf[0], BUFFERSIZE) == -1)
  255.               fatal1("patch: can't write temp file.\n");
  256.           break;
  257.       }
  258. ***************
  259. *** 258,264 ****
  260. --- 271,281 ----
  261.       }
  262.       Fclose(ifp);
  263.       Close(tifd);
  264. + #ifdef TURBOC20
  265. +     if ((tifd = open(TMPINNAME, O_BINARY)) < 0) {
  266. + #else
  267.       if ((tifd = open(TMPINNAME, 0)) < 0) {
  268. + #endif
  269.       fatal2("Can't reopen file %s\n", TMPINNAME);
  270.       }
  271.   }
  272. ***************
  273. *** 287,293 ****
  274.   #ifndef lint        /* complains of long accuracy */
  275.           Lseek(tifd, (long)baseline / lines_per_buf * BUFFERSIZE,